package Basic;

public class gongyinzi {
    public static void main(String[] args){
		int m=1000,n=495, a=495;
		for(;;a--){
			if((m%a==0)&&(n%a==0))
				break;
		}
		System.out.println(a);
	}
}
